//
//  ZHTabBarViewController.m
//  ZhanHui
//
//  Created by 彭超 on 16/5/12.
//  Copyright © 2016年 彭超. All rights reserved.
//

#import "ZHTabBarViewController.h"
#import "ZHNavigationController.h"

@interface ZHTabBarViewController ()

@end

@implementation ZHTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createItems];
}

-(void)createItems
{
    NSArray*titles=@[@"首页",@"艺展同城",@"机器人",@"我的"];
    NSArray*classArr=@[@"ZHShouYeViewController",@"ZHYiZhanTongChengViewController",@"ZHJiQiRenViewController",@"ZHWoDeViewController"];
    NSMutableArray*viewControllerarrays=[[NSMutableArray alloc]init];
    for (int i=0; i<titles.count; i++) {
        Class class=NSClassFromString(classArr[i]);
        UIViewController*vc=[[class alloc]init];
        vc.title=titles[i];
        ZHNavigationController*nav=[[ZHNavigationController alloc]initWithRootViewController:vc];
        [viewControllerarrays addObject:nav];
    }
    self.viewControllers=viewControllerarrays;
    
    NSArray * images = @[@"shouye", @"tongcheng",@"jiqiren",@"wode"];
    NSArray * selectedImages = @[@"", @"",@"",@""];
    for (int i=0; i<images.count; i++) {
        UITabBarItem * item = [[UITabBarItem alloc] initWithTitle:titles[i] image:[[UIImage imageNamed:images[i]] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:selectedImages[i]] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal]];
        UIViewController * vc = self.viewControllers[i];
        vc.tabBarItem=item;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
